﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

using MT.eVotePRS.Model;
using MT.eVotePRS.Presentation;
using MT.eVotePRS.Presentation.Presenter;

namespace MT.eVotePRS.UI.UserControls
{
    public partial class RptStudentStatus : UserControl, IViewRptStatus
    {
        #region IViewRptHandsetStatus

        IndividualReport _report;
        public IndividualReport Report
        {
            get { return _report; }
        }

        Status _inStatus;
        public Status InStatus
        {
            get { return _inStatus; }
        }

        public event EventHandler GenerateReport;

        #endregion
      
        public RptStudentStatus()
        {
            InitializeComponent();
            this.btnGen.Click += OnGenerateReportClicked;

            rbtCheckIn.CheckedChanged += OnCheckedChanged;
            rbtCheckOut.CheckedChanged += OnCheckedChanged;
            rbtFault.CheckedChanged += OnCheckedChanged;
            rbtLost.CheckedChanged += OnCheckedChanged;

            rbtCheckOut.Checked = true;
        }

        void OnGenerateReportClicked(object sender, EventArgs e)
        {
            EventHandler handlers = GenerateReport;
            if (handlers != null)
            {
                handlers(this, EventArgs.Empty);
            }
        }

        void OnCheckedChanged(object sender, EventArgs e)
        {
            if (rbtCheckIn.Checked)
            {
                _inStatus  = Presentation.Util.Constants.Status_CheckIn;
            }
            else if (rbtCheckOut.Checked)
            {
                _inStatus = Presentation.Util.Constants.Status_CheckOut;
            }
            else if (rbtFault.Checked)
            {
                _inStatus = Presentation.Util.Constants.Status_Fault;
            }
            else if ( rbtLost.Checked)
            {
                _inStatus = Presentation.Util.Constants.Status_Lost;
            }
        }
    }
}
